package com.example.weizix.presenter;

import com.example.weizix.base.BasePresenter;
import com.example.weizix.bean.DailyNewsBean;
import com.example.weizix.model.DailyNewsModel;
import com.example.weizix.net.ResultCallBack;
import com.example.weizix.view.DailyNews;

public class DailyNewsPresenter extends BasePresenter<DailyNews> {

    private DailyNewsModel model;

    @Override
    protected void initModel() {
        model = new DailyNewsModel();
        addModel(model);
    }

    public void getLastesNews() {
        model.getLatestNews(new ResultCallBack<DailyNewsBean>() {
            @Override
            public void onSuccess(DailyNewsBean dailyNewsBean) {
                view.setData(dailyNewsBean);
            }

            @Override
            public void onFail(String msg) {

            }
        });
    }


    public void getOldNews(String s) {
        model.getOldNews(s,new ResultCallBack<DailyNewsBean>() {
            @Override
            public void onSuccess(DailyNewsBean dailyNewsBean) {
                view.setData(dailyNewsBean);
            }

            @Override
            public void onFail(String msg) {

            }
        });
    }
}
